package com.study.samsung.Control.htControl;

import com.study.samsung.Utils.BaseServlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Enumeration;

@WebServlet("/back")
public class BackServlet extends BaseServlet {
    @Override
    public String excute(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HttpSession session = request.getSession();
        Object obj = session.getAttribute("admin");
       if (obj==null){
           return "r:htlogin";
       }else {
           Enumeration em = request.getSession().getAttributeNames();
           while (em.hasMoreElements()){
               request.getSession().removeAttribute(em.nextElement().toString());
           }

           return "r:htlogin";
       }
    }

}
